import logging
import tornado.log

# 创建日志记录器
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

# 创建日志处理器
handler = logging.StreamHandler()
handler.setLevel(logging.INFO)

# 创建日志格式器
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)

# 将处理器添加到记录器中
logger.addHandler(handler)

from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado import ioloop

from flask import Flask
app = Flask(__name__)


@app.route('/')
def hello():
    return 'Hello, Flask!'


http_server = HTTPServer(WSGIContainer(app))
http_server.listen(8888)  # 监听端口8888

# 在启动时打印信息
logger.info('Server started on port 8888')

ioloop.IOLoop.current().start()